Overall Data Structure

Code
import { aq, op } from '@uwdata/arquero'
species_filt = aq.table(serengeti)
  .filter(aq.escape(r => op.includes(SpeciesInput, r.Species)))
  .reify()
Code
spec_counts = species_filt
  .groupby("Species")
  .rollup({
    count: d => op.count()
  })
  .orderby('Species')

Plot.plot({
  marks: [
    Plot.barY(spec_counts, {x: "Species", y: "count"})
  ],
  width: 786,
  marginLeft: 75,
  marginBottom: 100, 
  x: { tickRotate: 90 }
})
Code
cam_counts = species_filt
  .groupby("Camera.Site")
  .rollup({
    Freq: d => op.count()
  })

Plot.plot({
  x: { label: "Number of Images Captured", domain: [0, 4700] },
  y: { label: "Number of Camera Sites", domain: [0, 50] },
  marks: [
    Plot.rectY(cam_counts, 
      Plot.binX({y: "count"}, {x: {thresholds: 30, value: "Freq"}})
    )
  ],
  width: 786,
  marginLeft: 75
})
Code
ll_counts = species_filt
  .groupby("Camera.Site")
  .rollup({
    Freq: d => op.count()
  })
  .join_left(aq.table(camData))

Plot.plot({
  x: {
    label: "Longitude (m)",
    domain: [690000, 745000]
  },
  y: {
    label: "Latitude (m)",
    domain: [9706000, 9738000]
  },
  marks: [
    Plot.dot(ll_counts, {x: "Longitude..m.", y: "Latitude..m.", r: d => d.Freq/5000})
  ],
  width: 786,
  marginLeft: 75
})
Code

// Create checkbox of species
viewof SpeciesInput = Inputs.checkbox(
  speciesList["Species"].sort(),
  { value: speciesList["Species"].sort(),
    label: "Species to include:"
  }
)